<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8" isELIgnored="false"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="chtml" uri="http://www.szhelper.com/jsp/html"%>
<%@ page import="java.util.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-CN" lang="zh-CN">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<title>友情链接列表</title>
		<script type="text/javascript">
			$(document).ready(function(){
				$("td[title^='image://']").each(function(){
					var title = $(this).attr("title");
					var imgUrl = title.substring("image://".length);
					$(this).attr("title","").html('<img width="88" height="31" style="vertical-align:middle;" src="'+imgUrl+"?"+new Date().getTime()+'" />');//${pageContext.request.contextPath}/
				});
			});
			//获取选中的记录
			function getCheckedRecords(listName){
				// 存储选中的记录
				var checkedRecords = "";
				$('#main_table4'+listName+' input[name="id4'+listName+'"]').each(function(i){
					if(this.checked) checkedRecords += $(this).val()+',';
				});
				if("" == checkedRecords){
					return null;
				}else{
					checkedRecords = checkedRecords.substring(0, checkedRecords.length-1);
				}
				return checkedRecords;
			}
			function audit(isPass){
				var checkedRecords = getCheckedRecords("linkslist");
				if(checkedRecords == undefined || checkedRecords == null){
					alert("请选择您要操作的记录!");
				}else{
					if(confirm("确定对所选数据进行审核？")){
						//虚拟form表单提交
						var htmlStr = "<form name='formx1' method='post' action='<chtml:path path="/" />/links/audit' style='display:none'>"+
										"<input type='hidden' name='ids' value='"+checkedRecords+"' />"+
										"<input type='hidden' name='isPass' value='"+isPass+"' />"+
									"</form>";
						$("#linksForm").parent().html(htmlStr);
						$("form[name=formx1]").submit();
					}
				}
			}
		</script>
	</head>
	<body>
	<div class="youarehere">系统管理 &gt; <span>管理友情链接</span></div>
		<form action='<chtml:path path="/" />links/list' method="post" id="linksForm">
			<table width="99%" align="center" border="0" cellpadding="1"
				cellspacing="1" class="data_table">
				<tr>
					<td class="data_tab_th" colspan="4">查询友情链接</td>
				</tr>
				<tr>
					<td class="data_tab_tdr">审核状态</td>
					<td class="data_tab_tdl"><chtml:enum name="isPass" selected="${isPass}" defaultOption="--全部--" defaultValue="" textProperty="text" type="com.hengpeng.common.persist.entity.AbstractEntity$BoolValue" /></td>
					<td class="data_tab_tdr">网站名称</td>
					<td class="data_tab_tdl"><input type="text" value="${name}" name="name" /></td>
				</tr>
				<tr>
					<td class="data_tab_tdr">网站类型</td>
					<td class="data_tab_tdl"><chtml:enum name="webType" selected="${webType}" defaultOption="--全部--" defaultValue="" textProperty="text" type="com.hengpeng.itfinbase.persist.Links$WebType" /></td>
					<td class="data_tab_tdr">链接位置</td>
					<td class="data_tab_tdl"><chtml:enum name="type" selected="${type}" defaultOption="--全部--" defaultValue="" textProperty="text" type="com.hengpeng.itfinbase.persist.Links$LinkType" /></td>
				</tr>
				<tr>
					<td align="center" colspan="4" class="bg_bai">
		
					<div class="mr_20 t_c">
						<input type="submit" class="pub_bt" value="查询" onclick='document.getElementsByName("PaginationButton_CurrentPage4list")[0].value=1;'/>
						<input type="button"  class="pub_bt" value="重置" onclick="this.form.reset();" />
					</div>
					
				    </td>
				</tr>
			</table>
			<br />
			<!-- 自定义标签示例 --> 
			<chtml:list collection="linkslist" type="com.hengpeng.itfinbase.persist.Links" 
				includeFields="name,logo,webType,email,qq,phone,operator,isPass,checker,type,sort,lastUpdateTime" fieldWidth="80,60,60,100,50,70,50,50,50,50,50,80"
				paginationName="linksListPage" showCheckBox="true" title="链接列表" allowSort="false"
				detailLink="preview?url=@{url}" showLinkField="name" updateLink="get?id=@{id}" deleteLink="delete?ids=@{id}" linkTarget="_self">
				<input type="button" value="新增" onclick="javascript:location.href='<%=request.getContextPath()%>/links/new'" />
				<input type="button" value="批量删除" onclick="javascript:helper.fun.deleted('<%=request.getContextPath()%>/links/delete','ids','id4linkslist','linksForm');" />
				<input type="button" value="审核通过" onclick="javascript:audit('YES');" />
				<input type="button" value="审核不通过" onclick="javascript:audit('NO');" />
			</chtml:list>
		</form>
		<!--说明   -->	
<div class="sm_info">
	<p class="row_one">说明：</p>
	<p class="other"></p>
	<p class="other"></p>
</div>
	</body>
</html>

